package com.yuanchu.goods.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-02-28 23:54
 */
@Configuration
public class ElasticsearchConfig {


    @Bean
    public RestHighLevelClient restHighLevelClient(){
        RestClientBuilder builder = RestClient.builder(HttpHost.create("http://192.168.101.130:9200"));
        //创建RestHighLevelClient客户端
        return new RestHighLevelClient(builder);
    }
}
